package com.zkr.sparecost.mapper;

import com.zkr.sparecost.model.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import javax.validation.Valid;
import java.util.Date;
import java.util.List;

/**
 * Created by lenovo on 2020/12/18.
 */
@Mapper
public interface SpareCostMapper {


    int queryCount(SpareSelectVo spareSelectVo);

    List<SpareCostClassVo>
    query(SpareSelectVo spareSelectVo);



    void updateStatus(SpareCostUpdateStatusVo spareCostUpdateStatusVo);



    List<TaxVo> queryTaxById(Integer taxId);



    List<LegalPlantClassVo> queryLegalPlantId(String legalPersonCode);

   // Price queryById(Integer priceId);

    @Select("select currencyCode,currencyCodeName  from currency ")
    List<CurrencyVo> queryCurrency();

    @Select("select priceType,priceTypeName from pricetype ")
    List<PriceType> queryPriceType();



    int querySpareCount(SpareFrameSelectVo spareFrameSelectVo);

    List<SpareFrame> querySpare(SpareFrameSelectVo spareFrameSelectVo);

    //void insertPlantClass(SpareCostClassVo spareCostClassVo);

    void insertSpareClass(SpareCostAddVo spareCostAddVo);

    void update(SpareCostClassVo spareCostClassVo1);

    @Select("select * from price where id=#{id}")
    SpareCostClassVo queryById(Integer id);

    //SpareCostClassVo queryAddTime(@Valid SpareCostAddVo spareCostAddVo);

    @Select("select * from price where startTime=#{startTime}")
    SpareCostClassVo queryAddTime(@Valid SpareCostAddVo spareCostAddVo);

    @Update("update price set price=#{price} where id=#{id}")
    void updateSparePrice(@Valid SpareCostAddVo spareCostAddVo);

    @Select("select id,endTime,startTime from price where materialCode=#{materialCode}")
    List<TimeList> queryDateTime( SpareCostAddVo spareCostAddVo);

    @Update("update price set endTime=#{endTime} where id=#{id}")
    void ddupdateTime(TimeList timeList1);

    @Select("select materialCode from price")
    List<CodeList> queryCode(@Valid SpareCostAddVo spareCostAddVo);

    @Select("select endTime from price")
    Date queryEndTime(Date endTime);

    @Select("select startTime from price")
    Date queryStartTime(Date startTime);




    @Select("select materialCode,startTime from price where id=#{id}")
    CodeList queryTimes(@Valid SpareCostUpdate spareCostUpdate);

    @Select("select startTime  from price where materialCode=#{materialCode}")
    List<StartTimeVo> selectByCode(CodeList codeList);

    @Select("select * from  price where id=#{id}")
    TimesStatus queryTimess(@Valid SpareCostUpdateStatusVo spareCostUpdateStatusVo);


    //List<StartTimeVo> selectByCode(@Valid SpareCostUpdate spareCostUpdate);


    //@Select("select * from price where status=#{status}")
    //void queryStatus(SpareCostClassVo spareCostClassVo);


    // @Select("select startTime from price")
    //SpareCostClassVo queryByStartTime(Date startTime);
}
